package com.example.demo.controller;

import com.example.demo.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
//给接口增加注释
@Api("HelloController控制类")
@RestController //没有界面，返回一个字符串
public class HelloController {
    @GetMapping(value = "/hello")
    public String hello(){
        return "hello";
    }

    @GetMapping(value = "/user")
    public User getUser(){
        return new User("郑辉盛","123456");
    }

    @ApiOperation("hello控制类")
    @PostMapping("/hello2")
    public String hello2(@ApiParam("用户名") String userName){
        return "hello" + userName;
    }

    @ApiOperation("Post测试类")
    @PostMapping("/hello3")
    public User hello3(@ApiParam("用户名") User user){
        return user;
    }
}
